<head>
    <link rel="stylesheet" href="<%= themeConfig.domain %>/media/css/bootstrap.min.css%>">
    <link rel="stylesheet" href="<%= themeConfig.domain %>/styles/main.css">
    <% if(site.customConfig.codetheme == 'default'){ %>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/default.min.css">
    <% }else if(site.customConfig.codetheme == 'vs2015'){ %>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/vs2015.min.css">
    <% }else if(site.customConfig.codetheme == 'rainbow'){ %>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/rainbow.min.css">
    <% }else{ %>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/dracula.min.css">
    <% } %>
    <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/highlight.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/850552586/ericamcdn@0.1/js/clipboard.min.js"></script>
    <link rel="stylesheet" href="<%= themeConfig.domain %>/media/css/live2d.css%>">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- fancybox -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
    <script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>


    <!--------- 数学公式👇---- -->
    <% if (site.customConfig.Mathchoice){ %>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css"
        integrity="sha384-9tPv11A+glH/on/wEu99NVwDPwkMQESOocs/ZGXPoIiLE8MU/qkqUcZ3zzL+6DuH" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.js"
        integrity="sha384-U8Vrjwb8fuHMt6ewaCy8uqeUXv4oitYACKdB0VziCerzt011iQ/0TqlSlv8MReCm" crossorigin="anonymous">
    </script>
    <script src="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/contrib/auto-render.min.js"
        integrity="sha384-aGfk5kvhIq5x1x5YdvCp4upKZYnA8ckafviDpmWEKp4afOZEqOli7gqSnh8I6enH" crossorigin="anonymous">
    </script>
    <script>
        renderMathInElement(document.body, {
            delimiters: [{
                    left: "$$",
                    right: "$$",
                    display: true
                },
                {
                    left: "$",
                    right: "$",
                    display: false
                }
            ]
        });
    </script>
    <%}%>
    <!--------- 数学公式👆----------------- -->
    <!--------- daovocie功能👇 ------------------->
    <% if (site.customConfig.instantchoice=='daovoice'){ %>
    <script>
        (function (i, s, o, g, r, a, m) {
            i["DaoVoiceObject"] = r;
            i[r] = i[r] || function () {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
            a = s.createElement(o), m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            a.charset = "utf-8";
            m.parentNode.insertBefore(a, m)
        })(window, document, "script", ('https:' == document.location.protocol ? 'https:' : 'http:') +
            "//widget.daovoice.io/widget/" + "<%=site.customConfig.daovoice_id%>" + ".js", "daovoice")
    </script>
    <%}else if(site.customConfig.instantchoice=='crisp'){%>
    <script type="text/javascript">
        window.$crisp = [];
        window.CRISP_WEBSITE_ID = "<%= site.customConfig.crisp_id%>";
        (function () {
            d = document;
            s = d.createElement("script");
            s.src = "https://client.crisp.chat/l.js";
            s.async = 1;
            d.getElementsByTagName("head")[0].appendChild(s);
        })();
    </script>
    <%}%>
    <!--------- daovocie功能👆 ------------------->
    <!-- -----------------twikoo评论系统引入👇 --------->
    <script src="https://cdn.jsdelivr.net/npm/twikoo@1.3.1/dist/twikoo.all.min.js"></script>
    <!-- -----------------twikoo评论系统引入👆 --------->
    <!---------------- leancloud api 功能依赖引入👇 -------->
    <script src="https://cdn.jsdelivr.net/npm/leancloud-storage@3.13.0/dist/av-min.js"></script>
    <!---------------- leancloud api 功能依赖引入👆 -------->
    <!------------------ valine评论系统引入👇 ------------------>
    <script src="<%= themeConfig.domain %>/media/js/valine.min.js%>"></script>
    <!------------------ valine评论系统引入👆 ------------------>
    <!---------------- 今日诗词api功能依赖👇 ----------------------->
    <script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
    <!---------------- 今日诗词api功能依赖👆 ----------------------->
    <!---------------- 今日诗词api功能依赖👇 ----------------------->
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ispeak-bber/ispeak-bber.min.js" charset="utf-8"></script>
    <!---------------- 哔哔功能依赖👆 ----------------------->


</head>

<style>
    body {
        overflow-x: hidden;
        height: 100vh;
        overflow-y: scroll;
        cursor: url("<%= themeConfig.domain %>/media/images/mouse_cursor.png%>"), auto
    }
</style>

<body>
    <!--=------ 页面加载动态画面👇 --------------->
    <div class="pjaxloading" onclick="pjaxloadingClose()">
        <div class="loadingbackground"></div>
        <div id="loading-aname">
            <div class="loading-aname">
            </div>
        </div>
    </div>
    <!--=------ 页面加载动态画面👆 --------------->

    <!--------------- 左侧菜单栏👇 ------------------------>
    <%if(site.customConfig.menuposition=='left'){%>
    <div id=side>
        <div class="r_m_div">
            <a onclick="showAaplayer()"><i style="font-size: 20px;"><img
                        src='<%= themeConfig.domain %>/media/images/music.png%>' alt="音乐播放器" class="musicbtn"></i></a>
        </div>
        <div class="avatar-border">
            <img src="<%= themeConfig.domain %>/images/avatar.png?v=<%= site.utils.now %>" class="avatar">
        </div>
        <div class="sitename"><%=themeConfig.siteName%></div>
        <span class="description" data-text='["<%- themeConfig.siteDescription %>"]'>&nbsp;</span>
        <div class="siteinfocontainer">
            <span class="siteinfo">文章</span>
            <span class="siteinfo">标签</span>
        </div>
        <div class="siteinfocontainer">
            <span class="siteinfo" id="siteinfo-postsnum"></span>
            <span class="siteinfo"><%= site.tags.length%></span>
        </div>
        <%if (site.customConfig.search){ %>
        <div class="search">
            <!-- <input type="text" class="search-input" placeholder="标题搜索(●'◡'●)" /> -->
            <input type="text" class="search-input" placeholder="<%= site.customConfig['searchplaceholder'] %>">
            <div class="search-results"></div>
        </div>
        <%}%>
    <div class="share-button">
        <span><%= site.customConfig.social_text%></span>
        <% if (site.customConfig['github']) { %>
        <a href="<%= site.customConfig['github'] %>" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/github.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['QQ']) { %>
        <a onclick="showqq()"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/QQ.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['zhihu']) { %>
        <a href="<%= site.customConfig['zhihu'] %>" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/zh.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['bilibili']) { %>
        <a href="<%= site.customConfig['bilibili'] %>" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/bilibili.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['wechat']) { %>
        <a onclick="showWechat()"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/wechat.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['weibo']) { %>
        <a href="<%= site.customConfig['weibo'] %>" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/weibos.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['wyy']) { %>
        <a href="<%= site.customConfig['wyy'] %>" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/wyy.png%>" alt=""></i></a>
        <% } %>
        <% if (site.customConfig['steam']) { %>
        <a href="<%= site.customConfig['steam'] %>" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="<%= themeConfig.domain %>/media/images/steam.png%>" alt=""></i></a>
        <% } %>
    </div>
    <div id="qq" style="display:none"><%= site.customConfig['QQ'] %></div>
    <!------------ 加载菜单按钮👇 ------------------------->
    <div class="menucontainer">
        <% menus.forEach(function(menu) { %>
        <% if (menu.openType === 'External') { %>
        <div class="mchocie description">
            <a href="<%= menu.link %>" class="mchocie description" target="_blank" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="<%= menu.name%>"></i>&nbsp;<span
                    data-text="<%= menu.name%>"><%= menu.name %></span>
            </a>
        </div>
        <% } else { %>
        <div class="mchocie description">
            <a data-pjax href="<%= menu.link %>" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="<%= menu.name%>"></i>&nbsp;<span
                    data-text="<%= menu.name%>"><%= menu.name %></span>
            </a>
        </div>
        <% } %>
        <% });%>

        <%if(site.customConfig.talkchoice){%>
        <div class="mchocie description">
            <a data-pjax href="<%= themeConfig.domain %>/talk" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="说说"></i>&nbsp;<span data-text="说说">说说</span>
            </a>
        </div>
        <%}%>
        <%if(site.customConfig.bbchoice){%>
            <div class="mchocie description">
                <a data-pjax href="<%= themeConfig.domain %>/bber" class="menubutton" style="margin-right: 15px;">
                    <i><img class="icon menuicon" src="" alt="哔哔"></i>&nbsp;<span data-text="哔哔">哔哔</span>
                </a>
            </div>
        <%}%>
        <%if(site.customConfig.friendschoice){%>
        <div class="mchocie description">
            <a data-pjax href="<%= themeConfig.domain %>/friends" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="友人帐"></i>&nbsp;<span data-text="友人帐">友人帐</span>
            </a>
        </div>
        <%}%>
        <!-- <%if(site.customConfig.fog_go){%>
        <div class="mchocie description">
            <a data-pjax href="#terrestrial" id="fog_go" class="open-popup menubutton" style="margin-right: 15px;">
                    <i><img class="icon menuicon" src="" alt="御风飞行"></i>&nbsp;<span data-text="御风飞行">御风飞行</span>
            </a>
        </div>
        <%}%> -->
    </div>
    <!------------ 加载菜单按钮👆 ------------------------->
    <hr>
    <%- include('./footer') %>
    </div>

    <img class="moon" src="<%= themeConfig.domain %>/media/images/moon.png%>" onclick="moonlight()">
    <script src="<%= themeConfig.domain %>/media/js/wordshow.js%>"></script>
    <%}%>
    <!--------------- 左侧菜单栏👆 ------------------------>

    <!----------------- 顶部菜单栏👇 ------------------------>
    <%if(site.customConfig.menuposition=='top'){%>
    <div>
        <nav class="navbar navbar-inverse navbar-fixed-top navbartop">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <a data-pjax class="navbar-brand" href="<%= themeConfig.domain %>"
                        style="font-size:21px"><%=themeConfig.siteName%>&nbsp;&nbsp;|&nbsp;&nbsp;</a>
                    <a class="navbar-brand topdescription" href=""
                        style="font-size:15px;font-family:kaiti"><%- themeConfig.siteDescription %></a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse">
                    <%if (site.customConfig.search){ %>
                    <div class="search nav navbar-nav" style="margin-top:8px">
                        <!-- <input type="text" class="search-input" placeholder="标题搜索(●'◡'●)" /> -->
                        <input type="text" class="search-input"
                            placeholder="<%= site.customConfig['searchplaceholder'] %>">
                        <div class="search-results"></div>
                    </div>
                    <%}%>
                <div class="search nav navbar-nav searchtop">
                <a title="社交信息" onclick="document.getElementById('socialMenu').style.display='block'" class="topshare-button"><i><img class="social"
                    src="<%= themeConfig.domain %>/media/images/social.png%>"></i></a>
                    <a onclick="showAaplayer()"><i style="font-size: 20px;"><img
                                src='<%= themeConfig.domain %>/media/images/music.png%>' alt="音乐播放器"
                                class="musicbtn musictop"></i></a>
                </div>
                <ul class="nav navbar-nav" style="float: right;margin-right:5%">
                    <% menus.forEach(function(menu) { %>
                    <% if (menu.openType === 'External') { %>
                    <li><a href="<%= menu.link %>" target="_blank"  class="menutopbutton">
                            <i style="font-size: 40px;"><img class="icon menuicon" src=""
                                    alt="<%= menu.name%>"></i><%= menu.name %>
                        </a></li>
                    <% } else { %>
                    <li>
                        <a data-pjax href="<%= menu.link %>"  class="menutopbutton">
                            <i style="font-size: 40px;"><img class="icon menuicon" src="" alt="<%= menu.name%>"></i>
                            <%= menu.name %>
                        </a>
                    </li>
                    <% } %>
                    <% }); %>
                    <%if(site.customConfig.talkchoice){%>
                    <li><a data-pjax href="<%= themeConfig.domain %>/talk"  class="menutopbutton">
                            <i style="font-size: 40px;"><img class="icon menuicon" src="" alt="说说"></i>说说
                        </a></li>
                    <%}%>
                    <%if(site.customConfig.bbchoice){%>
                        <li><a data-pjax href="<%= themeConfig.domain %>/bber"  class="menutopbutton">
                            <i style="font-size: 40px;"><img class="icon menuicon" src="" alt="哔哔"></i>哔哔
                        </a></li>
                    <%}%>
                    <%if(site.customConfig.friendschoice){%>
                    <li><a data-pjax href="<%= themeConfig.domain %>/friends"  class="menutopbutton">
                            <i style="font-size: 40px;"><img class="icon menuicon" src="" alt="友人帐"></i>友人帐
                        </a></li>
                    <%}%>
                    <!-- <%if(site.customConfig.fog_go){%>
                        <li><a data-pjax href="#terrestrial" id="fog_go" class="open-popup" style="color:white">
                                <i style="font-size: 40px;"><img class="icon menuicon" src="" alt="御风飞行"></i>御风飞行
                            </a></li>
                    <%}%> -->
                  <li><img src="<%= themeConfig.domain %>/images/avatar.png?v=<%= site.utils.now %>" alt=""
                    class="menutopavatar"></li>
                </ul>
            </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>
    <div id="socialMenu">
        <div class="animate">
            <div class="socialContainer">
                <% if (site.customConfig['github']) { %>
                <a href="<%= site.customConfig['github'] %>" target="_blank"><i style="font-size: 40px;"><img
                            class="icon " src="<%= themeConfig.domain %>/media/images/github.png" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['QQ']) { %>
                <a onclick="showqq()" style="cursor:pointer"><i style="font-size: 40px;"><img class="icon"
                            src="<%= themeConfig.domain %>/media/images/QQ.png" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['zhihu']) { %>
                <a href="<%= site.customConfig['zhihu'] %>" target="_blank"><i style="font-size: 40px;"><img
                            class="icon" src="<%= themeConfig.domain %>/media/images/zh.png" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['bilibili']) { %>
                <a href="<%= site.customConfig['bilibili'] %>" target="_blank"><i style="font-size: 40px;"><img
                            class="icon" src="<%= themeConfig.domain %>/media/images/bilibili.png" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['wechat']) { %>
                <a onclick="showWechat()"><i style="font-size: 40px;"><img class="icon"
                            src="<%= themeConfig.domain %>/media/images/wechat.png" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['weibo']) { %>
                <a href="<%= site.customConfig['weibo'] %>" target="_blank"><i style="font-size: 40px;"><img
                            class="icon" src="<%= themeConfig.domain %>/media/images/weibos.png%>" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['wyy']) { %>
                <a href="<%= site.customConfig['wyy'] %>" target="_blank"><i style="font-size: 40px;"><img class="icon"
                            src="<%= themeConfig.domain %>/media/images/wyy.png%>" alt=""></i></a>
                <% } %>
                <% if (site.customConfig['steam']) { %>
                <a href="<%= site.customConfig['steam'] %>" target="_blank"><i style="font-size: 40px;"><img
                            class="icon" src="<%= themeConfig.domain %>/media/images/steam.png" alt=""></i></a>
                <% } %>
            </div>
            <div id="qq" style="display:none"><%= site.customConfig['QQ'] %></div>
        </div>
    </div>
    <img class="moon" src="<%= themeConfig.domain %>/media/images/moon.png%>" onclick="moonlight()">
    <script>
        var social = document.getElementById('socialMenu');
        var fancybox = document.getElementsByClassName('fancybox-stage');
        // 鼠标点击模型外区域关闭登录框
        window.onclick = function (event) {
            if (event.target == social) {
                social.style.display = "none";
            }
        }
    </script>
    </div>
    <%}%>
    <!----------------- 顶部菜单栏👆 ------------------------>

<!--核心功能加载-->
<script src="<%= themeConfig.domain %>/media/js/mainfunc.js"></script>

<!------------- Fog1.0版本彩蛋👇 -------------->
    <!-- <section id="terrestrial" class="popup">
        <a href="#" class="back">&lt; back</a>
    </section>

    <div class="flycontainer">
        <div class="flyword">御风飞行中...</div>
    </div>

    <script>
        $("#fog_go").click(function(){fog_go()});
        async function fog_go(){
            $(".bars").hide()
            $("#live2d").hide()
            await sleep(3000);
            $(".flycontainer").css("display","flex");
            $(".popup").fadeOut(500)
            await sleep(2000);
            var sitename = "<%=themeConfig.siteName%>";
            getFogUser(sitename);
        }

        function fog_goregis(){
            var sitename = "<%=themeConfig.siteName%>";
            var siteurl = "<%= themeConfig.domain %>";
            regisFogUser(sitename,siteurl);
        }
        fog_goregis();
    </script> -->
<!------------- Fog1.0版本彩蛋👆 -------------->
<script>
    function change_topmenu(){
        tmcolor = "<%=site.customConfig.sitemenuColor%>"
        tsnamecolor = "<%=site.customConfig.sitenameColor%>"
        $(".navbar-inverse .navbar-nav>li>a").css("color",tmcolor)
        $(".navbar-inverse .navbar-brand").css("color",tsnamecolor)
        $(".navbar-fixed-top").css("border-radius","0 0 10px 10px")
    }
</script>

<!------ 根据自定义配置声明变量👇 --------------------->
    <%if(site.customConfig.postnumChoice){%>
    <script>
        var postnumChoice = true
    </script>
    <%}else{%>
    <script>
        var postnumChoice = false
    </script>
    <%}%>
    <%if(site.customConfig.shareChoice){%>
    <script>
        var shareChoice = true
    </script>
    <%}else{%>
    <script>
        var shareChoice = false
    </script>
    <%}%>
    <%if(site.customConfig.donateChoice){%>
    <script>
        var donateChoice = true
    </script>
    <%}else{%>
    <script>
        var donateChoice = false
    </script>
    <%}%>
    <%if(site.customConfig.search){%>
    <script>
        var searchChoice = true
    </script>
    <%}else{%>
    <script>
        var searchChoice = false
    </script>
    <%}%>
    <script>let postsnum = 0;</script>
    <div id="side-posttitle" style="display: none;">
    <% site.posts.forEach(function(post) { %>
    <% if(!post.hideInList){ %>
    <%= post.title %>
    <script>
        postsnum += 1
    </script>
    <% } %>
    <%});%>
    </div>
    <%if(site.customConfig.menuposition=='top'){%>
        <script>
            change_topmenu()
            var menupos = 'top'
            $(".topdescription").css("color","<%=site.customConfig.sitedescribtionColor%>")
        </script>
        <%}else{%>
        <script>
            var menupos = 'left';
            $("#siteinfo-postsnum").html(postsnum);
        </script>
    <%}%>
    <script>
        let commentsHide = false
    </script>
    <!------ 根据自定义配置声明变量👆 --------------------->


    <!----------根据自定义配置设置图标信息👇---------->
    <script>
        var icondict = new Array();
    </script>
    <%if(site.customConfig.icons){%>
        <% site.customConfig.icons.forEach(function(icon) {%>
            <script>
                var iconname = "<%= icon.menuname%>";
                var iconurl = "<%= icon.iconurl%>";
                icondict[iconname] = iconurl;
            </script>
        <%})%>
    <%}%>
    <!----------根据自定义配置设置图标信息👆---------->
</body>

<script src="<%= themeConfig.domain %>/media/share/dist/Share.js"></script>
<!-- 页面pjax测试 -->
<script src="https://cdn.bootcdn.net/ajax/libs/jquery.pjax/2.0.1/jquery.pjax.js"></script>
<!--确保jQuery已经在此之前加载-->
<!-- <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> -->
<script src="<%= themeConfig.domain %>/media/js/all-pjax.js"></script>
<script>
    //-------------------------------说说功能👇--------------------------------------
    let talksall = [];
    let talks = [];
    let talkindex = 0;
    get();

    function get() {
        var t = JSON.parse('<%- JSON.stringify(site.customConfig.talks) %>');
        talkindex = t.length - 1;
        for (var i = 0; i <= t.length - 1; i++) {
            var d = {};
            d["time"] = t[i].time;
            d["author"] = t[i].author;
            d["text"] = t[i].text;
            d["img"] = t[i].img;
            talksall.push(d);
        }
    }

    function add() {
        for (var i = talkindex; i >= 0 && i > talkindex - 3; i--) {
            talks.push(talksall[i]);
        }
        talkindex = (talkindex - 3) >= 0 ? (talkindex - 3) : -1;
        if (talkindex < 0) $("#getmorebt").hide();
        show();
    }

    function show() {
        var talkT = document.getElementById("talkContainer");
        talkT.innerHTML = "";
        for (var i = 0; i < talks.length; i++) {
            if (talks[i].img != '') {
                talkT.innerHTML += '\
            <div class="talk" v-for="t in talks"> \
                <span data-fancybox="images" href="' + talks[i].img + '"><img src="' + talks[i].img + '" class="talkimg"></span> \
                <div class="ainfo">\
                    <div class="ainfo-intro">\
                        <div class="author">' + talks[i].author + '</div>·\
                        <div class="time">' + talks[i].time + '</div>\
                    </div>\
                </div>\
                <div class="talkcontent">' + talks[i].text + '\
                </div\>\
            ';
            } else {
                talkT.innerHTML += '\
            <div class="talk" v-for="t in talks"> \
                <div class="ainfo">\
                    <div class="ainfo-intro">\
                        <div class="author">' + talks[i].author + '</div>·\
                        <div class="time">' + talks[i].time + '</div>\
                    </div>\
                </div>\
                <div class="talkcontent">' + talks[i].text + '\
                </div\>\
            ';
            }
        }
    }
    //-------------------------------说说功能👆--------------------------------------
</script>

<!---->
<script>
    function replaceAvatar() {
        twikoo_avatar = $(".tk-avatar-img");
        for (var i = 0; i < twikoo_avatar.length; i++) {
            var asrc = twikoo_avatar.eq(i).attr('src');
            if (asrc.search('cn.gravatar.com') != -1) {
                twikoo_avatar.eq(i).attr('src', '<%= themeConfig.domain %>/media/images/comavatar.png%>');
            }
        }
    }

    function showWechat() {
        var wechat = '<%= site.customConfig.wechat %>';
        alert("博主微信号：" + wechat);
        return false;
    }
</script>

<script>
    /**
     * https://github.com/tangkaichuan/gridea-search
     */
    // 检查缓存是否最新
    function checkCache() {
        var caches_postsnum = localStorage.getItem("postsnum");
        var pt = document.getElementById("side-posttitle").innerHTML;
        pt = pt.replace(/\s+/g, '').replace(/<script>.*?<\/script>/gi, "")
        var ptlen = pt.length;
        var ptlen_storage = localStorage.getItem("poststitlelen");
        if (caches_postsnum != postsnum || ptlen != ptlen_storage) {
            console.log("更新缓存");
            return false
        }
        return true;
    }

    (function () {
        var CACHES = checkCache()
        if (!CACHES) {
            var NOW = Date.now()
            var API_CONTENT = '../api-content/index.html' + '?_=' + NOW
            preload(API_CONTENT);
            getContents(show_getContentresult);
        }

        function show_getContentresult(data) {
            console.log("获取成功");
            var postslen = data["posts"].length;
            localStorage.setItem('postsnum', postslen);
            var poststitlelen = 0;
            var pt = document.getElementById("side-posttitle").innerHTML;
            pt = pt.replace(/\s+/g, '').replace(/<script>.*?<\/script>/gi, "");
            localStorage.setItem('poststitlelen', pt.length);
        }



        // preload
        function preload(url) {
            var preloadLink = document.createElement('link')
            preloadLink.href = url
            preloadLink.rel = 'preload'
            preloadLink.as = 'fetch'
            preloadLink.crossOrigin = 'anonymous'
            document.head.appendChild(preloadLink)
        }

        // 异步 GET 请求
        function get(obj) {
            var xhr = new XMLHttpRequest()
            xhr.open('get', obj.url, true)
            xhr.send(null)
            xhr.onreadystatechange = function () {
                // 异步请求：响应状态为4，数据加载完毕
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        obj.success(xhr.responseText)
                    } else {
                        obj.error(xhr.status)
                    }
                }
            }
        }

        // 获取博客全文 api
        function getContents(callback) {
            if (CACHES) {
                callback(CACHES.contents)
            } else {
                get({
                    url: API_CONTENT,
                    success: function (data) {
                        callback(JSON.parse(data));
                        localStorage.setItem('ContentsCache', data);
                        getStorageContent();
                    }
                })
            }
        }
    })()
    //------------------------核心功能--pjax全局渲染👇-------------------
    let talkinit = false;
    $(document).pjax('a[data-pjax]', '#main', {
        fragment: '#main',
        timeout: 8000
    }).on('pjax:complete', function () {
        //代码块高亮渲染
        document.querySelectorAll('pre code').forEach((block) => {
            hljs.highlightBlock(block);
        });
        //文章热度
        if(postnumChoice){
            getHotnum();
        }
        //文章索引
        toginit();
        //清空搜索栏
        if (searchChoice) {
            searchInit();
            searchInput.value = "";
        }
        var pl = window.location.pathname;
        //说说更新
        if (pl.search("talk") != -1 && !talkinit) {
            add();
            talkinit = true;
        } else if (pl.search("talk") != -1) {
            show();
        }
        if (pl.search("post") != -1) {
            if (shareChoice)
                shareInit();
            if (donateChoice)
                donateInit();
            if ("<%= site.customConfig.commentschoice%>" == "default"&&!commentsHide) {
                $("#comment").hide()
                commentsHide = true
            }
            lazyload();
            codeinit();
            if ("<%= site.customConfig.commentschoice%>" == "twikoo") {
                //twikoo头像更换
                setTimeout(replaceAvatar, 3000);
                setTimeout(replaceAvatar, 8000); //部分博主站点速度加载过慢，再添加一个延迟
            }
        }
        if (btstate == true)
            dropdown();
    }).on('pjax:start', function () {
        $(".pjaxloading").fadeIn(50);
    }).on('pjax:end', function () {
        $(".pjaxloading").fadeOut(50);
    });
    //------------------------核心功能--pjax全局渲染👆-------------------

    //-------------------------------------------------搜索
    // 获取搜索框、搜索按钮、清空搜索、结果输出对应的元素
    if (searchChoice) {
        var searchInput = document.querySelector('.search-input');
        var searchResults = document.querySelector('.search-results');
    }
    // 申明保存文章的标题、链接、内容的数组变量
    var searchValue = '',
        arrItems = [],
        arrLinks = [],
        arrTitles = [],
        arrContents = [],
        arrResults = [],
        indexItem = [],
        itemLength = 0;
    var tmpDiv = document.createElement('div');
    tmpDiv.className = 'result-item';


    function getStorageContent() {
        var data = localStorage.getItem('ContentsCache');
        data = JSON.parse(data);
        posts = data["posts"];
        for (var i = 0; i < posts.length; i++) {
            arrLinks[i] = posts[i].link;
            arrTitles[i] = posts[i].title;
            arrContents[i] = posts[i].content;
            itemLength++;
        }
    }
    if (checkCache())
        getStorageContent();
    // 输入框内容变化后就开始匹配，可以不用点按钮
    // 经测试，onkeydown, onchange 等方法效果不太理想，
    // 存在输入延迟等问题，最后发现触发 input 事件最理想，
    // 并且可以处理中文输入法拼写的变化
    searchInput.oninput = function () {
        setTimeout(searchConfirm, 0);
    }
    searchInput.onfocus = function () {
        searchResults.style.display = 'block';
    }

    function searchConfirm() {
        if (searchInput.value == '') {
            searchResults.style.display = 'none';
        } else if (searchInput.value.search(/^\s+$/) >= 0) {
            // 检测输入值全是空白的情况
            searchInit();
            var itemDiv = tmpDiv.cloneNode(true);
            itemDiv.innerText = '请输入有效内容...';
            searchResults.appendChild(itemDiv);
        } else {
            // 合法输入值的情况
            searchInit();
            searchValue = searchInput.value;
            // 在标题、内容中查找
            searchMatching(arrTitles, arrContents, searchValue);
        }
    }

    // 每次搜索完成后的初始化
    function searchInit() {
        arrResults = [];
        indexItem = [];
        searchResults.innerHTML = '';
        searchResults.style.display = 'block';
    }

    function searchMatching(arr1, arr2, input) {
        // 忽略输入大小写
        input = new RegExp(input, 'i');
        var step = 10;
        // 在所有文章标题、内容中匹配查询值
        for (i = 0; i < itemLength; i++) {
            var indexContent = arr2[i].search(input);
            //标题匹配
            if (arr1[i].search(input) != -1) {
                indexItem.push(i); // 保存匹配值的索引
                if (indexContent != -1) {
                    startindex = (indexContent - step) >= 0 ? (indexContent - step) : 0;
                    var searchcontent = arr2[i].slice(indexContent - step, indexContent + 5)
                    arrResults.push("....." + searchcontent + ".....");
                } else
                    arrResults.push("");
            }
            //内容匹配
            else if (indexContent != -1) {
                indexItem.push(i); // 保存匹配值的索引

                startindex = (indexContent - step) >= 0 ? (indexContent - step) : 0;
                var searchcontent = arr2[i].slice(indexContent - step, indexContent + 5)
                arrResults.push("....." + searchcontent + ".....");
            }
        }

        // 输出总共匹配到的数目
        var totalDiv = tmpDiv.cloneNode(true);
        totalDiv.innerHTML = '<b>总匹配：' + indexItem.length + ' 项<hr></b>';
        searchResults.appendChild(totalDiv);

        // 未匹配到内容的情况
        if (indexItem.length == 0) {
            var itemDiv = tmpDiv.cloneNode(true);
            itemDiv.innerText = '未匹配到内容...';
            searchResults.appendChild(itemDiv);
        }

        // 将所有匹配内容进行组合
        for (i = 0; i < arrResults.length; i++) {
            var itemDiv = tmpDiv.cloneNode(true);
            itemDiv.innerHTML = '<a data-pjax class="searchresults" href="' + arrLinks[indexItem[i]] + '"><b>[' +
                arrTitles[indexItem[i]] +
                ']</b><p>' + arrResults[i] + '</p></a><hr />';
            searchResults.appendChild(itemDiv);
        }
    }
</script>
<% if (site.customConfig.instantchoice=='daovoice'){ %>
<script>
    daovoice('init', {
        app_id: "<%= site.customConfig.daovoice_id%>"
    });
    daovoice('update');
</script>
<%}%>


<!--------------------- 菜单栏图标加载功能👇 ----------------------->
<script>
var menulist = $(".menuicon");
var menulength = menulist.length;
for (var i = 0; i < menulength; i++) {
    var altname = menulist.eq(i).attr("alt");
    var iconurl = icondict[altname];
    if (iconurl == undefined || iconurl == '')
        continue;
    if (iconurl == 'Home') {
        menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/Home.png%>");
menulist.eq(i).show();
} else if (iconurl == 'Archive') {
menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/Archive.png%>");
menulist.eq(i).show();
} else if (iconurl == 'Tag') {
menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/Tag.png%>");
menulist.eq(i).show();
} else if (iconurl == 'About') {
menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/About.png%>");
menulist.eq(i).show();
} else if (iconurl == 'Talk') {
menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/Talk.png%>");
menulist.eq(i).show();
} else if (iconurl == 'Friends') {
menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/Friends.png%>");
menulist.eq(i).show();
} else if (iconurl == 'Fly') {
menulist.eq(i).attr("src", "<%= themeConfig.domain %>/media/images/wind.png%>");
menulist.eq(i).show();
} else {
menulist.eq(i).attr("src", iconurl);
menulist.eq(i).show();
}
}
</script>
<!--------------------- 菜单栏图标加载功能👆 ----------------------->

<script>
    //--------------------bber-onetalk加载👇--------------------------------
    function bberonetalkLoad(){
        bberjsonurl = '<%=site.customConfig.bbjson%>';
        if ( $("#bber-talk").length > 0 ) {
        jsonUrl = bberjsonurl
        $.getJSON(jsonUrl+"?t="+Date.parse( new Date()),function(res){
        var bberHtml = ''
        $.each(res.data, function(i, item){
            d = new Date(item.date)
            date = d.getFullYear()+'/'+(d.getMonth()+1)+'/'+d.getDate() +' '+d.getHours()+':'+d.getMinutes()+':'+d.getSeconds()
            dataTime = '<span class="datatime">'+date+'</span>'
            bberHtml += '<li class="item item-'+(i+1)+'">'+dataTime+'： <a data-pjax href="<%= themeConfig.domain %>/bber">'+item.content+'</a></li>'
        });
        $('#bber-talk').append('<span class="index-talk-icon"><svg viewBox="0 0 1024 1024" width="21" height="21"><path d="M184.32 891.667692c-12.603077 0-25.206154-2.363077-37.809231-7.876923-37.021538-14.966154-59.864615-49.624615-59.864615-89.009231v-275.692307c0-212.676923 173.292308-385.969231 385.969231-385.969231h78.76923c212.676923 0 385.969231 173.292308 385.969231 385.969231 0 169.353846-137.846154 307.2-307.2 307.2H289.083077l-37.021539 37.021538c-18.904615 18.116923-43.323077 28.356923-67.741538 28.356923zM472.615385 195.347692c-178.018462 0-322.953846 144.935385-322.953847 322.953846v275.692308c0 21.267692 15.753846 29.144615 20.48 31.507692 4.726154 2.363077 22.055385 7.876923 37.021539-7.08923l46.473846-46.473846c6.301538-6.301538 14.178462-9.452308 22.055385-9.452308h354.461538c134.695385 0 244.184615-109.489231 244.184616-244.184616 0-178.018462-144.935385-322.953846-322.953847-322.953846H472.615385z"></path><path d="M321.378462 512m-59.076924 0a59.076923 59.076923 0 1 0 118.153847 0 59.076923 59.076923 0 1 0-118.153847 0Z"></path><path d="M518.301538 512m-59.076923 0a59.076923 59.076923 0 1 0 118.153847 0 59.076923 59.076923 0 1 0-118.153847 0Z"></path><path d="M715.224615 512m-59.076923 0a59.076923 59.076923 0 1 0 118.153846 0 59.076923 59.076923 0 1 0-118.153846 0Z"></path></svg></span><ul class="talk-list">'+bberHtml+'</ul>')
        //Lately({ 'target': '#bber-talk .datatime' });
        });
        function Roll (){
        var list_li = $('.talk-list li'),cur_li = list_li.first(),last_li = list_li.last();
        last_li.after(cur_li);
        };
        setInterval(Roll,3000);
    }
    }
  //--------------------bber-onetalk加载👆--------------------------------
</script>

<script>
    var ClicksideState = 1
    var cur_readingmode = false
    function readingmode(){
        if (!cur_readingmode){
            if(menupos == 'left'){
                if(ClicksideState==1)
                menu_openclose1()
            }
            $("#tab1").fadeOut(50)
            $("#bg").fadeOut(50)
            $(".navbar").fadeOut(50)
            $(".markdownIt-TOC li a").css("color","black")
            cur_readingmode = true
        }else{
            if(menupos == 'left'){
                if(ClicksideState==0)
                    menu_openclose1()
            }
            $("#tab1").fadeIn(50)
            $("#bg").fadeIn(50)
            $(".navbar").fadeIn(50)
            $(".markdownIt-TOC li a").css("color","antiquewhite")
            cur_readingmode = false  
        }
    }
</script>


<!----夜间模式👇-->
<script>
    var moonlightState = false
    function moonlight(){
        if(!moonlightState){
            $("#bg").fadeOut(200)
            $('body').css("background","rgba(0,0,0,0.8)")
            $(".markdownIt-TOC li a").css("color","white")
            $(".text p, .text ul").css("color","white")
            $("#articlecontent").css("color","white")
            $(".post-copyright").css("background","rgba(10,10,10,0.5)")
            $('blockquote').css("background","rgba(10,10,10,0.6)")
            $("#articlecontent").css("background","rgba(10,10,10,0.5)")
            moonlightState = true
            $(".moon").attr("src","<%= themeConfig.domain %>/media/images/sun.png%>")
        }else{
            $("#bg").show()
            $(".markdownIt-TOC li a").css("color","antiquewhite")
            $(".text p, .text ul").css("color","rgba(0, 0, 0, 0.7)")
            $("#articlecontent").css("color","black")
            $(".post-copyright").css("background","#f9f9f9")
            $('blockquote').css("background","#eff8f0")
            $("#articlecontent").css("background","white")
            $(".moon").attr("src","<%= themeConfig.domain %>/media/images/moon.png%>")
            $('body').css("background","white")
            moonlightState = false
        }
    }
</script>
<!----夜间模式👆-->